//
//  ActivityDetailApplyNumberCell.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 16/9/5.
//  Copyright © 2016年 陈区. All rights reserved.
//

#import "ActivityDetailApplyNumberCell.h"

@implementation ActivityDetailApplyNumberCell

+ (instancetype)cellWithTableView:(UITableView*)tableView
{
    ActivityDetailApplyNumberCell* cell = [tableView dequeueReusableCellWithIdentifier:kActivityDetailApplyNumberCellIdentifier];
    
    if (cell == nil) {
        
        cell = [[ActivityDetailApplyNumberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kActivityDetailApplyNumberCellIdentifier];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier
{
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    return self;
}

- (void)setFrame:(CGRect)frame
{
    frame.size.width = [UIScreen mainScreen].bounds.size.width;
    [super setFrame:frame];
}

- (void)setupUI
{
    self.accessoryType = UITableViewCellAccessoryNone;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    CGRect cellBounds = CGRectMake(10, 44, CGRectGetWidth(self.bounds), 0.5);
    UIImageView *linebg = [[UIImageView alloc] initWithFrame:cellBounds];
    linebg.image = [UIImage imageWithContentsOfFile:SEGPicName(@"common_line610px.png")];
    [self.contentView addSubview:linebg];

    UILabel * lblNum = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 80, 44)];
    lblNum.font = [UIFont systemFontOfSize:FONT_LIST_AND_DETAIL_SIZE];
    lblNum.textColor=kColor_2;
    lblNum.backgroundColor = [UIColor clearColor];
    lblNum.text=@"报名人数";
    [self.contentView addSubview:lblNum];
    
    UIImageView* box=[[UIImageView alloc] initWithFrame:CGRectMake(100, 7, 105, 30)];
    box.image=[UIImage imageWithContentsOfFile:SEGPicName(@"groupShoppingBox.png")];
    [self.contentView addSubview:box];
    
    self.reduceButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.reduceButton.frame = CGRectMake(100, 7, 35, 30);
    [self.reduceButton setImage:[UIImage imageWithContentsOfFile:SEGPicName(@"act_jie_nor")] forState:UIControlStateNormal];
//    [self.reduceButton addTarget:self action:@selector(reduceButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.reduceButton];
    
    self.numberCount= [[UITextField alloc] initWithFrame:CGRectMake(100+105/3, 7, 35, 30)];
    self.numberCount.backgroundColor = [UIColor clearColor];
    self.numberCount.userInteractionEnabled =YES;
    self.numberCount.font = [UIFont systemFontOfSize:FONT_LIST_AND_DETAIL_SIZE];
    self.numberCount.textColor = [UIColor colorWithHexString:@"#666666"];
    self.numberCount.textAlignment = NSTextAlignmentCenter;
    self.numberCount.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    self.numberCount.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    self.numberCount.returnKeyType = UIReturnKeyDone;
    self.numberCount.keyboardType = UIKeyboardTypeNumberPad;
//    self.numberCount.delegate = self;
//    self.numberCount.text = [NSString stringWithFormat:@"%d",number];
    [self.contentView addSubview:self.numberCount];
    
    
    self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.addButton.frame = CGRectMake(170, 7, 35, 30);
    [self.addButton setImage:[UIImage imageWithContentsOfFile:SEGPicName(@"act_add_nor")] forState:UIControlStateNormal];
//    [self.addButton addTarget:self action:@selector(addButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.addButton];
}

@end
